package com.laiketui.order.mapstruct;

import com.laiketui.domain.user.User;
import com.laiketui.order.api.dto.OrderParentMessageDTO;
import com.laiketui.order.api.dto.pay.UserBalanceDTO;
import com.laiketui.order.domain.OrderParentMessage;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Mapper
public interface UserMapstructMapper {
    UserMapstructMapper INSTANCE = Mappers.getMapper(UserMapstructMapper.class);


    @Mapping( target = "balance",expression="java(com.laiketui.order.utils.PriceUtil.longToBigDecimalPrice(user.getBalance()))")
    @Mapping( target = "frozenBalance",expression="java(com.laiketui.order.utils.PriceUtil.longToBigDecimalPrice(user.getFreezeBalance()))")
    @Mapping(target = "userId",source = "user_id")
    @Mapping(target = "storeId",source = "store_id")
    UserBalanceDTO toDTO(User user);



}
